A query is used to extract data from the database in a readable format according to the user's request. Navicat provides powerful tools for working with queries: Query Editor for editing the query text directly, and Query Builder, Find Builder or Aggregate Builder for building queries visually. You can save your queries for setting automation tasks. In the main window, click
Query to open the query object list. You can also click
New Query from the main toolbar to create a new query without opening any connections.
To open a query using an external editor, control-click it and select Open with External Editor. You can set the file path of an external editor in Preferences.
Hint: Queries (.sql or .js) are stored under the Settings Location. To open the folder, control-click a query and select Show in Finder. If the connection is synchronized to Navicat Cloud, its queries are stored in the Cloud.
Query Designer is the basic Navicat tool for working with queries.
Button |
Description |
MySQL, Oracle, PostgreSQL, SQLite, SQL Server and MariaDB |
|
|
Open the SQL Builder for building queries visually. |
|
Format the codes with the Beautify SQL settings in Editor. |
MongoDB |
|
|
Open the Find Builder for building queries visually. |
|
Open the Aggregate Builder for building queries visually. |
|
Format the codes in Editor. |
|
[Grid View] Use the specified type color set on the Type Color pane to highlight cells. |
Common |
|
|
Show the Code Snippet pane. |
|
Activate the assistant editors for viewing and editing data. |
|
Export the result of the query. |
|
Execute the query: Run, Run Current Statement, or Run Selected (when highlighted code). |
|
Stop the executing query. |
|
Show the Query Plan of the query: Explain or Explain Selected (when highlighted code). |
Open an external file in Navicat
In the main window, click
New Query.
In Query Designer, choose File -> Open External File.
Select the file.
Click Open.
Save an opened external file as a Navicat query
In Query Designer, choose File -> Save As Navicat Query.
Enter the query name and choose the save location.
Click OK.
Save a Navicat query as an external file
In Query Designer, choose File -> Save As External File.
Choose the save path and enter the file name.
Click Save.